<template>
	<view class="conts" >
		<view class="navw">
			<view class="viewbody" >
				<view @click="cbclick(0)" :class="[viewbodys[0]? 'viewboottom':'']">项目部</view>
			</view>
			<view class="viewbody" >
				<view @click="cbclick(1)" :class="[viewbodys[1]? 'viewboottom':'']">参建方</view>
			</view>
		</view>
		
		<view class="content1" v-if="content1" style="background-color: white;">
			
			
			<view>
				 <SortPickerList ref="sortPickerListCont" @clickData="clickDataCont"></SortPickerList>
								
			</view>
			
			
			
			
		</view>
		
		<view class="content2" v-if="content2" style="background-color: white;" >
			<view style="height: 100rpx;border-bottom: 1rpx solid #DEE4E4;line-height: 100rpx;">
																
			   <image style="width: 50rpx;height: 40rpx;position: relative;top: 10rpx;" src="../../static/images/jiantouyou.png"></image>	名称                                            
																
			</view>                                             
			<view style="height: 100rpx;border-bottom: 1rpx solid #DEE4E4;line-height: 100rpx;">
																 
				 <image style="width: 50rpx;height: 40rpx;position: relative;top: 10rpx;" src="../../static/images/jiantouyou.png"></image>  名称                                             
																 
			</view>                                              
			<view style="height: 100rpx;border-bottom: 1rpx solid #DEE4E4;line-height: 100rpx;">
				
				 <image style="width: 50rpx;height: 40rpx;position: relative;top: 10rpx;" src="../../static/images/jiantouyou.png"></image>  名称
				
			</view>
			
		</view>
		
	</view>
</template>

<script>
	import SortPickerList from "../../components/nickro-sortPickerList/nickro-sortPickerListp2.vue"
	var that;
	
	
	export default {
		components: {
			SortPickerList
		},
		data() {
			return {
				viewbodys:[true,false],
				content1:true,
				content2:false,
				dataArrCont: [
					{
						id: "1212",
						name: "张三",
						value: "value",
						ptName:"中瑞项目",
						institution:"施工员",
						imgPath:"http://ww1.sinaimg.cn/large/006Y8a9ily1gcydk81x90j30dw08paai.jpg"	,
						typeInfo:1
					}
					
				],
			}
		},
		onLoad(){
			that=this;
			
			try{
				const pid = uni.getStorageSync("projectId");
				const value = uni.getStorageSync("JSESSIONID");
				const val = uni.getStorageSync("pathHost");
				uni.request({
					url: val+'/ggcapp/userprojects/userproject/ggUserProject/data'+";JSESSIONID="+value+"?__ajax=true&mobileLogin=true&pageSize=999" ,
					data:{
						projectId:pid
					},
					success(data) {
						that.dataArrCont=[];
					        for (var i = 0; i < data.data.rows.length; i++) {		
					        	//console.log("id:"+data.data.rows[i].id+";uid:"+data.data.rows[i].uid)
					        	 that.dataArrCont.push({
					        		  id: data.data.rows[i].userId+"",
					        		  name: data.data.rows[i].name+"",
					        		  value: data.data.rows[i].phone+"",
					        		  ptName:data.data.rows[i].projectName+"",
					        		  institution:data.data.rows[i].roleName+"",
					        		  imgPath: val+""+data.data.rows[i].photo+""	,
					        		  typeInfo:1
					        	}) 
					        
					        }
					       setTimeout(function(){
					       	  that.$refs["sortPickerListCont"].initPage(that.dataArrCont)
					       },100);	 
													
						}
				})
				
	
			}catch (e) {
			   uni.showToast({
			   	title: 'erro',
			     duration: 2000
			   })
			}
			
	
			
		},
		methods: {
			cbclick:function(e){
				let v=[];
				for (var i = 0; i <this.viewbodys.length; i++) {
					if(e==i){			
						v.push(true)
					}else{
						v.push(false)
					}
				}
				this.viewbodys=v;
				if(e==0){
					this.content1=true;
					this.content2=false;
					setTimeout(function(){
						  that.$refs["sortPickerListCont"].initPage(that.dataArrCont)
					},100);	 
				}
				if(e==1){
					this.content2=true;
					this.content1=false;
				}
						
						
			},
			clickDataCont:function(data) {
					
			//	console.log('获取全部值：' + JSON.stringify(data)) 
				uni.navigateTo({
					// url: '../addressList/info?name='+data.label+"&phone="+data.value
							url: '../addressList/info?data='+JSON.stringify(data)
				}) 
				
			},
		}
	}
</script>

<style>

.conts{
		width: 100%;
		
	}
.navw{
	   width: 100%;
	   height: 90rpx;
	   position: -webkit-sticky;
	   position: sticky;
	   top: 0rpx;
	  z-index: 999;
	   display: flex;
	   border-bottom:1px solid  #DEE4E4;
	   
   }
    .navw>.viewbody{
		float: left;
		width: 33.3%;
		height:90rpx;
		line-height: 90rpx;
	  background-color: white;
	  padding-left: 5%;
	  padding-top: 3px;
	}
	.viewbody{
		 flex-grow: 1;
	}
   .viewbody>view{
	   text-align: center;
	   height: 100%;
	   width: 100%;
  
   }
   .viewboottom{
	    border-bottom: 1px solid #71B6F7;
		color:#71B6F7 ;
   }


</style>
